<?php
#基础函数
include_once('_path.php');
include_once("../includes/init.php");
#样式
$css = array();
$js = array();
#菜单
$menu = "members";

#uid
$uid = intval($_GET['uid']);

#页码
$page = trim($_GET['page']) + 0;
#每页数量
$pagesize = 50;
#获得总页数
$sql = "SELECT count(*) total FROM members_file WHERE uid=".$uid;
$rs = $database->queryArray($sql);
$total_sites= $rs[0]["total"];
$total_page = ceil($total_sites/ $pagesize);
#计算页数
if ($total_page < 1) $total_page = 1;
if ($page < 1) $page = 1;
if ($page > $total_page) $page = $total_page;
#正式读内容
$sql = "SELECT * FROM members_file WHERE uid=".$uid.
	" LIMIT ".(($page - 1) * $pagesize).", $pagesize";
$rsc = $database->queryArray($sql);

include_once("../layout/_header.php");
?>
        <div class="main">
       		<div class="traininc-nav-list">
				<ul>
                                <li><a href="<?= _CONST_BACKEND_URL ?>/members/edit.php?action=view.form&id=<?=$uid ?>">基本信息</a></li>
                                <li class="selected"><a href="javascript:">文件上传</a></li>
                                <li><a href="<?= _CONST_BACKEND_URL ?>/message/index.php?uid=<?=$uid?>">留言管理</a></li>
                                <li><a href="<?= _CONST_BACKEND_URL ?>/cardbind/index.php?uid=<?=$uid?>">绑定会员卡</a></li>
				</ul>
			</div>
			<div class="box-con">
				<table class="table-blue">
					<thead>
						<tr>
							<th>编号</th>
							<th>文件名</th>
							<th>上传日期</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
                                         <?
                                        for($i=0;$i<sizeof($rsc);$i++){
                                        $r = $rsc[$i];
                                        $j = 1;
                                        ?>
                                        <tr <?=iif($j%2==0, 'class="odd"')?>>
                                                        <td><?=$r['id']?></td>
							<td><?=$r['filename']?></td>
							<td><?=date(_CONST_DATE_FORMAT.' '._CONST_TIME_FORMAT,$r['dateline'])?></td>
							<td><a href="edit.php?action=down.do&id=<?=$r['id']?>">下载</a> | <a href="edit.php?action=delete.do&id=<?=$r['id'] ?>">删除</a></td>
					</tr>
                                        <?
                                        $j++;
                                        }
                                        ?>
					</tbody>
				</table>
				<br />
				<h3>文件上传</h3>
                                <form action="edit.php?action=file.do" method="post" id="form" name="form" enctype="multipart/form-data">
                                    <input type="hidden" name="uid" value="<?= $uid ?>">
				<table class="table-input">
					<tr>
						<td class="title">选择文件</td>
						<td><input type="file" size="50" name="file" value="选择"></td>
					</tr>
					<tr>
						<td class="title">文件标题</td>
						<td><input type="text" size="100" name="filename"></td>
					</tr>
					<tr>
						<td class="title"> </td>
						<td><input type="submit" name="" value="上传" class="btnA" /><input type="reset" name="" value="取消" class="btnB" /></td>
					</tr>
				</table>
                                </form>
			</div>
        </div>
<?
include_once("../layout/_footer.php");
?>